import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test4 {
    public static void main(String[] args) throws Exception {
//        1、加载配置文件
        Reader reader = Resources.getResourceAsReader("mybatis.xml");
        //2、得到SqlSessionFactoryBuilder
        SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
        SqlSessionFactory build = builder.build(reader,"development2");
        //3、得到session对象
        SqlSession session = build.openSession();
        // 4、操作SQL
        Map map = session.selectOne("com.atshiyou.dao.StudentDao.find");
        System.out.println(map);
        
        System.out.println(map);
        session.commit();//还要提交事务，否则数据库里不会新增值
        session.close();
        reader.close();

    }
}
